package com.qdlc.p2p.dal.model;

import org.springframework.beans.BeanUtils;

import com.qdlc.p2p.dal.dto.AdditionalCommodity;

/**
 * Created by liaoxiangkai on 2015/12/9.
 */
public class AdditionalCommodityModel extends AdditionalCommodity{
    //搜索框输入字符串
    private String searchName;
    //修改者姓名
    private String modifierName;
    //创建者姓名
    private String creatorName;
    //当前页
    private int page;
    //每页记录数
    private int rows;

    /**************状态静态常量****************/
    //类别,1积分抽奖，2签到抽奖，3其他活动
    public static final int CATEGORY_SCORE = 1;
    public static final int CATEGORY_SIGN = 2;
    public static final int CATEGORY_OTHER = 3;
    //商品状态，0可使用，1不可使用
    public static final int STATUS_OPEN = 0;
    public static final int STATUS_CLOSE = 1;
    //删除，0未删除，1已删除
    public static final int IS_DELETE_NO = 0;
    public static final int IS_DELETE_YES = 1;

    public String getSearchName() {
        return searchName;
    }

    public void setSearchName(String searchName) {
        this.searchName = searchName;
    }

    public String getCreatorName() {
        return creatorName;
    }

    public void setCreatorName(String creatorName) {
        this.creatorName = creatorName;
    }

    public String getModifierName() {
        return modifierName;
    }

    public void setModifierName(String modifierName) {
        this.modifierName = modifierName;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getRows() {
        return rows;
    }

    public void setRows(int rows) {
        this.rows = rows;
    }

    /**
     * 从model拷贝属性
     * @param model
     * @return
     */
    public static AdditionalCommodity prototype(AdditionalCommodityModel model) {
        AdditionalCommodity additionalCommodity = new AdditionalCommodity();
        BeanUtils.copyProperties(model, additionalCommodity);
        return additionalCommodity;
    }

    /**
     * 实例化model
     * @param additionalCommodity
     * @return
     */
    public static AdditionalCommodityModel instance(AdditionalCommodity additionalCommodity) {
        AdditionalCommodityModel additionalCommodityModel = new AdditionalCommodityModel();
        BeanUtils.copyProperties(additionalCommodity, additionalCommodityModel);
        return additionalCommodityModel;
    }

}
